package org.study.springboot.learning.socker;

import org.apache.commons.net.SocketClient;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;


public class HelloServer {
    public static void main(String[] args) throws IOException {
        ServerSocket socket = null;
        try {
            //服务端
            socket = new ServerSocket(18888);
        } catch (IOException e) {
            System.err.println("ServerSocker出现错误");
            System.exit(1);
        }
        Socket socketClient = null;

        try {
            //用来接收客户端
            socketClient = socket.accept();
        } catch (IOException e) {
            System.err.println("Accept failed");
            System.exit(1);
        }

        System.out.println("Hello World");
        socket.close();
        socketClient.close();

    }
}
